package modele.dao;

import java.sql.SQLException;
import java.util.ArrayList;

import modele.database.IDatabase;

public class LoginDAO {
	private IDatabase conn;
	
	public LoginDAO(IDatabase conn) {
		this.conn = conn; 
	}

	public boolean Validate(String username, String password) throws SQLException, ClassNotFoundException {
		conn.Connect();
		ArrayList<ArrayList<Object>> pass = conn.Select("SELECT PASSWORD FROM LOGIN WHERE USERNAME = ?", username);
		conn.Close();
		
		return pass.size() == 1 && password.equals(pass.get(0).get(0).toString());
	}
}
